#define  _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <stdlib.h>
int duplicate(int* numbers, int numbersLen)
{
    // write code here
    int* times = (int*)calloc(numbersLen, sizeof(int));
    if (!times)
    {
        perror("times:");
        return 1;
    }
    int i = 0;
    for (i = 0; i < numbersLen; i++)
    {
        times[*(numbers + i)]++;
    }
    for (i = 0; i < numbersLen; i++)
    {
        if (times[*(numbers + i)] > 1)
            return *(numbers + i);
    }
    free(times);
    times = NULL;
    return -1;
}
int main()
{
    int arr[] = { 2,3,1,0,2,5,3 };
    int numbersLen = sizeof(arr) / sizeof(arr[0]);
    int s = duplicate(arr, numbersLen);
    printf("%d\n", s);

    return 0;
}
